/*
 * @Author: szx
 * @Date: 2021-11-01 11:14:48
 * @LastEditTime: 2021-11-01 11:20:11
 * @Description:
 * @FilePath: \leetcode\500-599\575\575.cpp
 */
#include <iostream>
#include <unordered_set>
#include <vector>
using namespace std;
class Solution {
   public:
    int distributeCandies(vector<int>& candyType) {
        int n = candyType.size();
        unordered_set<int> set;
        for (int i : candyType) {
            set.insert(i);
            if (set.size() == n / 2) {
                return n / 2;
            }
        }
        return set.size();
    }
};

int main() { return 0; }